package cn.buk.tms.vas.service;

import cn.buk.common.JsonResult;
import cn.buk.common.dto.CommonDto;
import cn.buk.tms.entity.misc.OperationLog;
import cn.buk.tms.sc.SearchFlightOrderCriteria;
import cn.buk.tms.vas.dto.request.VasOrderRequestDto;
import cn.buk.tms.vas.dto.response.VasOrderResponseDto;

import java.util.List;

/**
 * @author yfdai
 */
public interface VasOrderService {

    /**
     * 创建VAS订单
     * @param enterpriseId 当前用户的enterpriseId
     * @param operator 当前用户的用户名
     * @param dto 要保存的内容
     * @return 保存结果
     */
    JsonResult createVasOrder(int enterpriseId, String operator, VasOrderRequestDto dto);

    /**
     * 根据id获取vasOrder
     * @param enterpriseId enterpriseId
     * @param id id
     * @return 返回需要的对象或null
     */
    VasOrderResponseDto getVasOrderById(int enterpriseId, int userId, int id);

    /**
     * 查找服务订单
     * @param enterpriseId enterpriseId
     * @param username 当前用户名
     * @param sc 查找条件
     */
    List<VasOrderResponseDto> searchVasOrders(int enterpriseId, int userId, String username, SearchFlightOrderCriteria sc);
    CommonDto<VasOrderResponseDto> searchVasOrders2(int enterpriseId, int userId, String username, SearchFlightOrderCriteria sc);

    List<VasOrderResponseDto> searchInsuranceOrders(int enterpriseId, int userId, SearchFlightOrderCriteria sc);

    List<OperationLog> searchVasOrderHistory(int enterpriseId, int orderId);

    /**
     * 修改备注
     */
    JsonResult updateVasOrderRemark(int enterpriseId, String username, int orderId, String remark);

    /**
     * 修改供应商
     */
    JsonResult updateVasOrderSupplier(int enterpriseId, String username, int orderId, int supplierId, int paymentMethodId);
    /**
     * 取消订单
     */
    JsonResult cancelVasOrder(int enterpriseId, String username, int orderId, String remark);

    JsonResult processVasOrder(int enterpriseId, String username, int orderId);

    JsonResult finishVasOrder(int enterpriseId, String username, int orderId, String remark);

    JsonResult updateVasOrderPassenger(int enterpriseId, String username, int orderId, int psgId, String psgName, String psgIdNo, String psgRemark);

    /**
     * 把vasOrder修改为已支付
     */
    JsonResult updateVasOrderPaid(int enterpriseId, String username, int orderId, String remark);

    JsonResult updateVasOrderPrice(int enterpriseId, String username, int orderId, double price, double discount, double cost);

    JsonResult updateVasOrderPayment(int enterpriseId, String username, int orderId, int paymentMethodId);

    /**
     * 回滚服务单状态
     */
    JsonResult rollbackVasOrderStatus(int enterpriseId, String username, int id, final String remark);

    void autoAlertVasOrderStatus();

    void autoAlertInsuranceOrderStatus();

    /**
     * 检查需要和VAAS平台相关的订单
     */
    void checkVaasOrders(int enterpriseId, String username);
}
